package test;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;


public class GetFish {

    public static void main(String[] args) {
        String date1 = "1990.01.01"; // 开始“三天打鱼两天晒网”的日期
        String date2 = "1990.01.10"; // 手动输入的日期
        int day = fun(date1, date2);// 传入值计算时间差
        if (day % 5 == 4 || day % 5 == 0) {
            System.out.println("今天是休息日，可以晒晒网");
        } else {
            System.out.println("今天要工作，打鱼了！");
        }

    }
    public static int fun(String s1, String s2) {
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy.MM.dd");
        LocalDate time1 = LocalDate.parse(s1, dateTimeFormatter);
        LocalDate time2 = LocalDate.parse(s2, dateTimeFormatter);
        long between = ChronoUnit.DAYS.between(time1, time2);
        return (int) between;
    }
}